package com.zqxq.common.bizEnums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 测评类型
 */
public enum AppraisalTypeEnum {

    /** 单元测评 */
    UNIT_TESTING(1, "单元测评"),

    /** 综合测评 */
    COMPREHENSIVE_TESTING(2, "综合测评"),


    ;

    /** 枚举值 */
    private final int	code;

    /** 枚举描述 */
    private final String	message;

    /**
     * 构造一个<code>AppraisalTypeEnum</code>枚举对象
     *
     * @param code
     * @param message
     */
    private AppraisalTypeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * @return Returns the code.
     */
    public int getCode() {
        return code;
    }

    /**
     * @return Returns the message.
     */
    public String getMessage() {
        return message;
    }

    /**
     * @return Returns the code.
     */
    public int code() {
        return code;
    }

    /**
     * @return Returns the message.
     */
    public String message() {
        return message;
    }

    /**
     * 通过枚举<code>code</code>获得枚举
     *
     * @param code
     * @return AppraisalTypeEnum
     */
    public static AppraisalTypeEnum getByCode(int code) {
        for (AppraisalTypeEnum _enum : values()) {
            if (_enum.getCode() == (code)) {
                return _enum;
            }
        }
        return null;
    }

    /**
     * 获取全部枚举
     *
     * @return List<AppraisalTypeEnum>
     */
    public List<AppraisalTypeEnum> getAllEnum() {
        List<AppraisalTypeEnum> list = new ArrayList<AppraisalTypeEnum>();
        for (AppraisalTypeEnum _enum : values()) {
            list.add(_enum);
        }
        return list;
    }

    /**
     * 获取全部枚举值
     *
     * @return List<String>
     */
    public List<Integer> getAllEnumCode() {
        List<Integer> list = new ArrayList<Integer>();
        for (AppraisalTypeEnum _enum : values()) {
            list.add(_enum.code());
        }
        return list;
    }

    public List<Map<String, Object>> getListMap(){
        List<Map<String, Object>> arrayList = new ArrayList();
        for (AppraisalTypeEnum _enum : values()) {
            Map<String, Object> infoMap = new HashMap();
            infoMap.put("value",_enum.getCode());
            infoMap.put("label", _enum.getMessage());
            arrayList.add(infoMap);
        }
        return arrayList;
    }
    
}
